﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using QMERP.Domain.Entities;

namespace QMERP.Infrastructure.EFCore.Mappings
{
    public class Contract_Lens_SalesProcessConstraintMapping : IEntityTypeConfiguration<Contract_Lens_SalesProcessConstraint>
    {
        public void Configure(EntityTypeBuilder<Contract_Lens_SalesProcessConstraint> builder)
        {
            builder.Property(x => x.IsCombination);
            builder.Property(x => x.JuSe).IsRequired(false).HasMaxLength(6);
            builder.Property(x => x.ChaSe).IsRequired(false).HasMaxLength(6);
            builder.Property(x => x.ShuiYin).IsRequired(false).HasMaxLength(6);
            builder.Property(x => x.RanSe).IsRequired(false).HasMaxLength(10);
            builder.Property(x => x.UV);
            builder.Property(x => x.JingJia).IsRequired(false).HasMaxLength(20);
            builder.Property(x => x.JiaYing);
            builder.Property(x => x.PaoGuang);
            builder.Property(x => x.CaiBian).IsRequired(false).HasMaxLength(4);
            builder.Property(x => x.CheBian).IsRequired(false).HasMaxLength(10);
            builder.Property(x => x.KaiKeng).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.PiHua).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.DaoBian).IsRequired(false).HasMaxLength(10);
            builder.Property(x => x.MianWan).IsRequired(false).HasMaxLength(10);
            builder.Property(x => x.ZuanKong).IsRequired(false).HasMaxLength(10);
            builder.Property(x => x.OtherProcess).IsRequired(false).HasMaxLength(20);
            builder.Property(x => x.ExtraProcess).IsRequired(false).HasMaxLength(20);
            builder.Property(x => x.PricePcs).HasPrecision(18, 2);
            builder.Property(x => x.PricePairs).HasPrecision(18, 2);
            builder.Property(x => x.InvoiceStrENG).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.InvoiceStrCHS).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.InvoiceStrCHT).IsRequired(false).HasMaxLength(200);

            builder.Property(x => x.ContractId);
            builder.Property(x => x.LensId);

            builder.HasIndex(x => x.Id);
            builder.HasIndex(x => x.ContractId);
            builder.HasIndex(x => x.LensId);
        }
    }
}
